﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SchoolManagementSystem.Controls;
using SchoolManagementSystem.Forms.BusinessForm;
using CoreData;
namespace SchoolManagementSystem.Searchs
{
    public partial class Student_ResultSearchUC : SearchUC
    {
        public Student_ResultSearchUC()
        {
            InitializeComponent();
        }

        long ClassID;

        private void simpleButton_close_Click(object sender, EventArgs e)
        {
            ClosePanel();
        }

        private void buttonEdit_Class_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                frmSelectClass frm = new frmSelectClass(1);
                if(frm.ShowDialog()==DialogResult.OK)
                {
                    ClassID = frm.ID;
                    buttonEdit_Class.EditValue = "[" + frm.Code + "] " + frm.Name;
                }
                else
                {
                    ClassID = 0;
                    buttonEdit_Class.EditValue = "";
                }
            }
            catch
            {
                ClassID = 0;
                buttonEdit_Class.EditValue = "";
            }
        }

        private void cmdtim_Click(object sender, EventArgs e)
        {
            if(ClassID<=0)
            {
                MessageControl.ShowMessage("Vui lòng chọn lớp", "Yều cầu", MessageControl.Icon.Warning);
            }
            else
            {
                Master.SearchString = " c.Type=1 and c.ID=" + ClassID;
            }
        }

      
    }
}
